#ifndef IXDEVICE
#define IXDEVICE
#include "XComponent.h"
#include "Matrix.h"
#include "XIndexBuffer.h"
#include "XVertexBuffer.h"
#include "XTexture.h"
#include "XMaterial.h"
#include "XLight.h"
class XM_ENTRY XRender : public XObject{
protected:
	int s_device_type;
	static XRender* ptr_render;
public:
	XRender(){ ptr_render = this; };
	virtual bool CreateDevice() = 0;
	virtual void* GetDevice() = 0;
	//set the matrix to the view port
	virtual void SetViewMatrix(Matrix4& mat_view)=0;
	virtual void SetProjMatrix(Matrix4& mat_proj) = 0;
	virtual void SetWorldMatrix(Matrix4& mat_world) = 0;
	virtual void GetViewMatrix(Matrix4* ptr_mat_out_view) = 0;
	virtual void GetProjMatrix(Matrix4* ptr_mat_out_view) = 0;

	virtual bool CreateIndexBuffer(XIndexBuffer** ptr_index_buffer, UINT u_length, bool b_dynamic, bool b_managed, int i_format) = 0;
	virtual bool CreateVertexBuffer(XVertexBuffer** m_vertex_buffer, UINT u_length, bool b_dynamic, bool b_managed, int i_FVF) = 0;
	virtual bool CreateTexture(XTexture** ptr_texture)=0;

	virtual void SetRenderStream(UINT i_streamId, XVertexBuffer* ptr_vert, UINT u_offest, UINT u_stride) = 0;
	virtual void SetIndexStream(XIndexBuffer* ptr_indices) = 0;
	virtual void SetTexture(XTexture* ptr_tex) = 0;
	virtual void SetMaterial(XMaterial material) = 0;
	virtual void SetLight(int index,XLight* light) = 0;

	virtual void DrawObject(UINT u_draw_type, UINT u_base, UINT u_min, UINT u_vert_num, UINT u_start, UINT u_count) = 0;
	virtual void DrawLine(int start, int num) = 0;
	virtual void BeginRender() = 0;
	virtual void StopRender() = 0;
	virtual void FillWithColor(long u_color) = 0;
	virtual int GetScreenWidth() = 0;
	virtual int GetScreenHeight() = 0;

	virtual void SetRenderMode(int) = 0;
	virtual void SwitchLight(int index, bool state) = 0;
	static XRender* GetInstance(){ return ptr_render; }
	
};

#endif